import BuffUtil from '@/BuffUtil';
import UnitEvent from '@/event/UnitEvent';
import TalentBase from 'code/Scripts/Abilities/base/TalentBase';
const desc = `英雄体型随着等级增加，并每等级增加${ColorSafe}2.5%|r的分裂伤害和${ColorSafe}2.5|r的分裂范围。|n觉醒效果：每英雄等级还额外增加${ColorSafe}2.5%|r的精英伤害。`;
const art = 'ReplaceableTextures\\CommandButtons\\BTNMountainGiant.blp';
const name = '长大';
const config: TalentConfigModel = {
    id: 'talent_t_TalentGroth',
    name,
    desc,
    art,
    buffType: {
        id: 'buff_t_TalentGroth',
        art,
        name,
        ubertip: desc,
        stackCountMax: -1,
        attribute: {
            分裂伤害系数: 0.025,
            分裂范围系数: 2.5,
        },
    },
    buffTypePlus: {
        id: 'buff_t_TalentGroth_plus',
        art,
        name: '长大[觉醒]',
        ubertip: `英雄体型随着等级增加，并每等级增加${ColorSafe}2.5%|r的分裂伤害和${ColorSafe}2.5|r的分裂范围，并每级额外增加${ColorSafe}2.5%|r的精英伤害`,
        stackCountMax: -1,
        attribute: {
            分裂伤害系数: 0.025,
            分裂范围系数: 2.5,
            精英伤害增强: 0.025,
        },
    },
};
export default class TalentGroth extends TalentBase {
    static instance: TalentGroth;
    constructor(p?: TalentConfigModel) {
        super(p);
        TalentGroth.instance = this;
        this.setTalentConfig(config);
        this.onAddTalentPlus(this.onAddTalentPlusEffect);
        se.onHeroLevelUp(this.levelUpEffect);
    }
    onAddTalentPlusEffect<T, D extends TalentPlusData = TalentPlusData>(u: unit, talent: T, d: D) {
        d.newBuff.stackCount = d.prevBuff.stackCount;
    }
    levelUpEffect(d: UnitEvent) {
        let _this = TalentGroth.instance;
        let u = GetTriggerUnit();
        let normal = BuffUtil.getUnitBuff(u, _this.buffType.id);
        let plus = BuffUtil.getUnitBuff(u, _this.buffTypePlus.id);
        if (plus == null && normal == null) return;
        let lv = GetHeroLevel(u);
        normal != null && normal.stackCount++;
        plus != null && plus.stackCount++;
        let sc = 30 + lv;
        SetUnitScalePercent(u, sc, sc, sc);
    }
}
